/*
Copyright 2008, 2009 Joonas Lehtolahti

This file is part of Shared Datatypes and Utilities.

Shared Datatypes and Utilities is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Shared Datatypes and Utilities is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Shared Datatypes and Utilities.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _DEBUGS_H_
#define _DEBUGS_H_

#ifdef MEM_DEBUG
  void *mem_debug_pointer;
  #define dmalloc(size) (mem_debug_pointer = malloc(size)); fprintf(stderr, "malloc(%p) at %s:%d\n", mem_debug_pointer, __FILE__, __LINE__)
  #define dfree(pointer) fprintf(stderr, "free  (%p) at %s:%d\n", pointer, __FILE__, __LINE__); free(pointer)
#else
  #define dmalloc(size) malloc(size)
  #define dfree(pointer) free(pointer)
#endif

#ifdef DEBUG
  #define DBG(x) x
#else
  #define DBG(x) 
#endif

#endif

